package com.ma.user;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;

import com.ma.R;

/**
 * Created by loma on 2017/10/11.
 */

public class ChoseCompanyDialog extends AlertDialog {
    public ChoseCompanyDialog(Context context) {
        super(context);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(initView());
        setCanceledOnTouchOutside(true);
        Window window =   getWindow();
        WindowManager.LayoutParams lp = window.getAttributes();
        lp.width = WindowManager.LayoutParams.MATCH_PARENT;   //设置宽度充满屏幕
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        window.setAttributes(lp);
        initView();
    }

    private View initView() {
        View view= LayoutInflater.from(getContext()).inflate(R.layout.dialog_chose_company,null);
        ImageView close= (ImageView) view.findViewById(R.id.iv_close);
        close.setOnClickListener(view1 -> {
            dismiss();
        });
        return view;
    }
}
